﻿using Microsoft.Extensions.DependencyInjection;
using PLCS.App.UserAuthorization.Views.Menu;
using PLCS.App.UserAuthorization.Views.Role;
using PLCS.App.UserAuthorization.Views.User;
using PLCS.Client.Service.UserAuthorization;
using Prism.Ioc;
using Prism.Modularity;
using Volo.Abp.AutoMapper;
using Volo.Abp.Modularity;
using ZFGG_JTX_PLCS.App.UserAuthorization.ViewModels.Menu;
using ZFGG_JTX_PLCS.App.UserAuthorization.ViewModels.Role;
using ZFGG_JTX_PLCS.App.UserAuthorization.ViewModels.User;

namespace PLCS.App.UserAuthorization;

[DependsOn(typeof(AbpAutoMapperModule))]
public class UserAuthorizationModule : AbpModule, IModule
{
    public void OnInitialized(IContainerProvider containerProvider)
    {
    }

    public void RegisterTypes(IContainerRegistry containerRegistry)
    {
        containerRegistry.RegisterForNavigation<UserView, UserViewModel>();
        containerRegistry.RegisterForNavigation<UserDetailView, UserDetailViewModel>();

        containerRegistry.RegisterForNavigation<RoleView, RoleViewModel>();
        containerRegistry.RegisterForNavigation<RoleDetailView, RoleDetailViewModel>();

        containerRegistry.RegisterForNavigation<MenuView, MenuViewModel>();
        containerRegistry.RegisterForNavigation<MenuDetailView, MenuDetailViewModel>();
    }

    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        context.Services.AddAutoMapperObjectMapper<UserAuthorizationModule>();

        Configure<AbpAutoMapperOptions>(options =>
        {
            options.AddMaps<UserAuthorizationModule>();
        });
    }
}